import 'package:enterprise_v8/app/components/custom_app_bar.dart';
import 'package:enterprise_v8/app/core/core.dart';
import 'package:enterprise_v8/app/core/ext/widget_extension.dart';
import 'package:enterprise_v8/generated/assets.gen.dart';

import 'scan_login_controller.dart';

/// 扫码登录
class ScanLoginPage extends StatelessWidget {
  ScanLoginPage({super.key});

  final controller = Get.put(ScanLoginController());

  @override
  Widget build(BuildContext context) {
    return GetBuilder(
        init: controller,
        builder: (_) {
          return Scaffold(
            appBar: CustomAppBar(titleText: '扫码登录'),
            body: Container(
              alignment: Alignment.topCenter,
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Container(height: 10.w, color: Colors.grey[100]),
                  AppGaps.vGap60,
                  Assets.svg.bgScanLogin.svg(width: 200.w,height: 200.w),
                  AppGaps.vGap40,
                  Text(
                    '网页版登录确认',
                    style: TextStyle(
                      color: const Color(0xFF000000),
                      fontSize: 18.sp,
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                  AppGaps.vGap6,
                  Text(
                    '请核对登录设备信息,切勿在可疑设备登录',
                    style: TextStyle(
                      color: const Color(0xFF8791AA),
                      fontSize: 14.sp,
                      fontWeight: FontWeight.w400,
                    ),
                  ),
                  const Spacer(),
                  Container(
                      padding: EdgeInsets.symmetric(horizontal: 90.w, vertical: 12.w),
                      decoration: BoxDecoration(
                        color: const Color(0xff5C6DFF),
                        borderRadius: BorderRadius.all(Radius.circular(6.w)),
                      ),
                      child: Text(
                        '登录',
                        style: TextStyle(
                          fontSize: 18.sp,
                          color: const Color(0xffffffff),
                        ),
                      )).clickOnce(controller.onTapLogin),
                  Container(
                    padding: EdgeInsets.symmetric(vertical: 30.w),
                    child: Text(
                      '取消登录',
                      style: TextStyle(
                        fontSize: 18.sp,
                        color: const Color(0xFF8791AA),
                      ),
                    ),
                  ).clickOnce(Get.back),
                  AppGaps.vGap20,
                ],
              ),
            ),
          );
        });
  }
}
